<template>
	<view class="tabs-wrap">
		<u-tabs :is-scroll="false" :ref="tabDat.ref" :list="tabDat.tabList" :current="tabDat.currTab"
			activeColor="#00c3ce" @change="tabChange"></u-tabs>
		<view class="list-container">
			<template >
				<aircraft v-if='tabDat.currTab == 0'></aircraft>
				<train v-if='tabDat.currTab == 1'></train>
				<bus v-if='tabDat.currTab == 2'></bus>
				<chartered_bus v-if='tabDat.currTab == 3'></chartered_bus>
			</template>
		</view>	
	</view>
</template>

<script>
	import aircraft from './aircraft.vue';
	import bus from './bus.vue';
	import chartered_bus from './chartered_bus.vue';
	import train from './train.vue';
	export default {
		components: {
			aircraft,
			bus,
			chartered_bus,
			train
		},
		data() {
			return {
				// tab数据对象
				tabDat: {
					ref: 'orderListTabs',
					tabList: [{
							name: '飞机'
						},
						{
							name: '火车'
						},
						{
							name: '集合点'
						},
						{
							name: '包车'
						},
					],
				
					currTab: 0,
				},

			}
		},
		onLoad(e) {
			console.log(e,' --- onLoad')

		},
		created() {
			console.log(' --- mounted')
			let that = this
			let aircraft = uni.getStorageSync('aircraft');
			if(aircraft.num == '飞机'){
				that.tabDat.currTab = 0
			}else if(aircraft.num == '火车'){
				that.tabDat.currTab = 1
			}else if(aircraft.num == '集合点'){
				that.tabDat.currTab = 2
			}else if(aircraft.num == '包车'){
				that.tabDat.currTab = 3
			}
			console.log(that.tabDat.currTab,aircraft)
		},
		mounted() {
			
			
		},
		
		methods: {
			// tabs通知swiper切换
			tabChange(index) {
				this.tabDat.currTab = index;
			},
		}
	}
</script>

<style lang="scss">

</style>